/*
 * flashstream_task.h
 *
 *  Created on: 2024年8月13日
 *      Author: nwz
 */

#ifndef CODE_TASK_FLASH_STREAM_TASK_H_
#define CODE_TASK_FLASH_STREAM_TASK_H_
typedef enum {
	Flash_Stream_Task_State_Open,
	Flash_Stream_Task_State_Close,
	Flash_Stream_Task_State_Erase_Download,
	Flash_Stream_Task_State_Erase_BootLoader,
	Flash_Stream_Task_State_Erase_App,
	Flash_Stream_Task_State_Write_Download,
	Flash_Stream_Task_State_Write_BootLoader,
	Flash_Stream_Task_State_Write_App,
} flash_stream_task_state_t;

void flash_stream_task_init(SemaphoreHandle_t mtx);

void flash_stream_task_run(void *arg);

void flash_stream_task_set_state(flash_stream_task_state_t state);

int flash_stream_task_write_buffer(uint8_t *data, uint32_t len,flash_stream_task_state_t state);

uint32_t flash_stream_task_get_avaliabe_size(void);

void flash_stream_task_wait(uint32_t ticks);

uint32_t flash_stream_task_get_start_addr(void);

void flash_stream_task_wait_until_finish(void);
#endif /* CODE_TASK_FLASH_STREAM_TASK_H_ */
